<?php
/**
 * Created by PhpStorm
 * User: shen.zk
 * Date: 2023/9/13
 * Time: 15:39
 * Comment: ''
 */

namespace App\Http\Controllers\Common;

use App\Http\Controllers\BaseController;
use App\Params\Common\GoodsParams;
use App\Service\Common\GoodsService;
use App\Params\Common\GoodsMoveParams;
use App\Params\Common\GoodsUgcBindParams;
use App\Params\Common\GoodsUgcMoveParams;
use App\Params\Common\GoodsLockParams;

class GoodsController extends BaseController
{

    /**
     * 商品详情
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @throws \RedisException
     * Author:xsc
     * Time:2023/9/20 15:01
     */
    public function detail()
    {
        $params = GoodsParams::create();
        $data = GoodsService::getInstance()->detail($params);
        return $this->success($data);
    }

    /**
     * 商品通兑
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @throws \RedisException
     * Author:xsc
     * Time:2023/9/20 16:38
     */
    public function exchange()
    {
        $params = GoodsParams::create();
        $data = GoodsService::getInstance()->exchange($params);
        return $this->success($data);
    }

    /**
     * 商品通兑状态
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @throws \RedisException
     * Author:xsc
     * Time:2023/10/7 10:11
     */
    public function exchangeStatus()
    {
        $params = GoodsParams::create();
        $data = GoodsService::getInstance()->exchangeStatus($params);
        return $this->success($data);
    }

    /**
     * 商品转移
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @throws \RedisException
     * Author:xsc
     * Time:2023/9/20 18:32
     */
    public function move()
    {
        $params = GoodsMoveParams::create();
        $data = GoodsService::getInstance()->move($params);
        return $this->success($data);
    }

    /**
     * ugc赋能绑定
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @throws \RedisException
     * Author:xsc
     * Time:2023/10/10 16:16
     */
    public function ugcBind()
    {
        $params = GoodsUgcBindParams::create();
        $data = GoodsService::getInstance()->ugcBind($params);
        return $this->success($data);
    }

    /**
     * ugc赋能解绑
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * Author:xsc
     * Time:2023/10/10 17:20
     */
    public function ugcUnbind()
    {
        $params = GoodsUgcBindParams::create();
        $data = GoodsService::getInstance()->ugcUnbind($params);
        return $this->success($data);
    }

    /**
     * ugc商品转移
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * Author:xsc
     * Time:2023/10/16 9:43
     */
    public function ugcMove()
    {
        $params = GoodsUgcMoveParams::create();
        $data = GoodsService::getInstance()->ugcMove($params);
        return $this->success($data);
    }

    /**
     * 商品锁定/解锁
     * @return \Illuminate\Http\JsonResponse
     * @throws \App\Exceptions\BusinessException
     * @throws \RedisException
     * Author:xsc
     * Time:2023/12/6 15:25
     */
    public function lock()
    {
        $params = GoodsLockParams::create();
        $data = GoodsService::getInstance()->lock($params);
        return $this->success($data);
    }


}
